<!DOCTYPE html>
<head>
</head>
<body>
    <script src="/js-test-resources/js-test.js"></script>
    <script>
        window.jsTestIsAsync = true;
        description("The test passes if 'window.onerror' is not invoked on a script loaded with a 'crossorigin' attribute, but delivered without valid CORS headers.");

        var still_running = true;
        function shutdown() {
            if (still_running) {
                finishJSTest();
                still_running = false;
            }
        }

        window.onerror = function(msg, url, line, column, error) {
            window.fail = "FAIL";
            shouldBeUndefined("window.fail");
            shutdown();
        }
    </script>
    <script crossorigin="anonymous" src="http://localhost:8000/security/resources/cors-script.php?fail=true&cors=false"></script>
    <script>shutdown();</script>
</body>
</html>
